package com.zhida.jiyangcenter.api

import chooongg.base.manager.app
import chooongg.http.HttpManager
import com.vehicle.inspection.api.BaseTokenInterceptor
import com.zhida.jiyangcenter.utils.SP
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

interface APIPay {
    companion object {
        fun service() =
            HttpManager.create(app.applicationContext, "http://beauty.hebzd.com/api/") {
                addConverterFactory(GsonConverterFactory.create())
                addInterceptor("pay", BaseTokenInterceptor())
            }.getAPI(APIPay::class.java)
    }

    /**
     *支付宝支付
     */
    @POST("alipay")
    @FormUrlEncoded
    suspend fun alipay(
        @Field("code") code: String,
        @Field("kind") kind: String
    ): NetResponse<AlipayEntity>

    /**
     *微信支付
     */
    @POST("wxpay")
    @FormUrlEncoded
    suspend fun wxpay(
        @Field("code") code: String,
        @Field("kind") kind: String
    ): NetResponse<WechatEntity>

    /**
     *余额支付
     */
    @POST("balance")
    @FormUrlEncoded
    suspend fun balance(
        @Field("code") code: String,
        @Field("kind") kind: String
    ): NetResponse<Any>

    /**
     *运动项目数据更新
     */
    @POST("exercise/update")
    @FormUrlEncoded
    suspend fun exerciseUpdate(
        @Field("parm") parm: String,
        @Field("num") num: String
    ): NetResponse<Any>

    /**
     *膳食项目数据更新
     */
    @POST("meals/update")
    @FormUrlEncoded
    suspend fun mealsUpdate(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *睡眠记录更新
     */
    @POST("sleep/update")
    @FormUrlEncoded
    suspend fun sleepUpdate(
        @Field("parm") parm: String,
        @Field("num") num: String
    ): NetResponse<Any>

    /**
     *营养项目更新
     */
    @POST("nutrition/update")
    @FormUrlEncoded
    suspend fun nutritionUpdate(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *判断是否是新用户
     */
    @POST("mine/user/judge")
    @FormUrlEncoded
    suspend fun mineUserJudge(
        @Field("phone") phone: String
    ): NetResponse<MineUserJudgeEntity>

    /**
     *档案页面返回体质详情
     */
    @POST("health_test/user_data")
    suspend fun healthTestUserData(): NetResponse<HealthTestUserDataEntity>

    /**
     *健康测试返回页面
     */
    @POST("health_test/index")
    @FormUrlEncoded
    suspend fun health_testIndex(
        @Field("pinghezhi") pinghezhi: Int,
        @Field("qixuzhi") qixuzhi: Int,
        @Field("qiyuzhi") qiyuzhi: Int,
        @Field("shirezhi") shirezhi: Int,
        @Field("tanshizhi") tanshizhi: Int,
        @Field("tebingzhi") tebingzhi: Int,
        @Field("xueyuzhi") xueyuzhi: Int,
        @Field("yangxuzhi") yangxuzhi: Int,
        @Field("yinxuzhi") yinxuzhi: Int
    ): NetResponse<health_testIndexEntity>

}